exports.__esModule = true;

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

exports.default = class extends think.BaseController {

    /**
         * 获取部门及用户（根据用户岗位）
         */
    getDepartAndUserAction() {
        var _this = this;

        return _asyncToGenerator(function* () {
            let aj = think.ajaxJson();
            const JobService = _this.service('overallmerit/JobService');
            const data = {
                post_code: _this.get('post_code')
            };
            const res = yield JobService.getDepartAndUser(data);
            if (res && res.error) {
                aj.success = false;
                aj.msg = '查询失败';
            } else {
                aj.result = res;
            }
            return _this.json(aj);
        })();
    }
    /**
         * 按岗位编码获取用户列表
         */
    getAllUserByPostCodeAction() {
        var _this2 = this;

        return _asyncToGenerator(function* () {
            let aj = think.ajaxJson();
            const JobService = _this2.service('overallmerit/JobService');
            const data = {
                post_code: _this2.get('post_code')
            };
            const res = yield JobService.getAllUserByPostCode(data);
            if (res && res.error) {
                aj.success = false;
                aj.msg = '查询失败';
            } else {
                aj.result = res;
            }
            return _this2.json(aj);
        })();
    }
    /**
         * 信息采集员岗位评价（人员|时间）
         */
    getCollectEvalListAction() {
        var _this3 = this;

        return _asyncToGenerator(function* () {
            let aj = think.ajaxJson();
            const JobService = _this3.service('overallmerit/JobService');
            const data = _this3.post('cycle,rangeDate,rangeDate2,userList');
            const res = yield JobService.getCollectEvalList(data);
            if (res && res.error) {
                aj.success = false;
                aj.msg = '查询失败';
            } else {
                aj.result = res;
            }
            return _this3.json(aj);
        })();
    }
    /**
         * 受理人员岗位评价
         *
         */
    getCenterPerEvalListAction() {
        var _this4 = this;

        return _asyncToGenerator(function* () {
            let aj = think.ajaxJson();
            const JobService = _this4.service('overallmerit/JobService');
            const data = _this4.post('cycle,rangeDate,rangeDate2,userList');
            const res = yield JobService.getCenterPerEvalList(data);
            if (res && res.error) {
                aj.success = false;
                aj.msg = '查询失败';
            } else {
                aj.result = res;
            }
            return _this4.json(aj);
        })();
    }
    /**
         * 其他岗位 岗位评价
         *
         */
    getOhterPostEvalListAction() {
        var _this5 = this;

        return _asyncToGenerator(function* () {
            let aj = think.ajaxJson();
            const JobService = _this5.service('overallmerit/JobService');
            const data = _this5.post('cycle,rangeDate,rangeDate2,userList');
            const res = yield JobService.getOhterPostEvalList(data);
            if (res && res.error) {
                aj.success = false;
                aj.msg = '查询失败';
            } else {
                aj.result = res;
            }
            return _this5.json(aj);
        })();
    }

    getAllPostAction() {
        var _this6 = this;

        return _asyncToGenerator(function* () {
            let aj = think.ajaxJson();
            const JobService = _this6.service('overallmerit/JobService');
            const res = yield JobService.getAllPost();
            if (res && res.error) {
                aj.success = false;
                aj.msg = '查询失败';
            } else {
                aj.result = res;
            }
            return _this6.json(aj);
        })();
    }

    getAllUserAction() {
        var _this7 = this;

        return _asyncToGenerator(function* () {

            const JobService = _this7.service('overallmerit/JobService');
            const res = yield JobService.getAllUser();
            if (res) {
                return _this7.successJson(res);
            } else {
                return _this7.errorJson('查询失败');
            }

            return _this7.json(aj);
        })();
    }

};